﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using log4net;
using RealState.BLL;

namespace RealState.W.AdminControl
{
    public partial class ImagesList : System.Web.UI.UserControl
    {
        private ImagesBLL m_ImagesBLL;
        protected ILog log = LogManager.GetLogger(typeof(ImagesList));
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack) {
                m_ImagesBLL = new ImagesBLL();
                try
                {
                    rptCategories.DataSource = m_ImagesBLL.GetImagess();
                    rptCategories.DataBind();
                }
                catch (Exception ex)
                {
                    log.Error(ex.Message);
                }
                finally {
                    m_ImagesBLL = null;
                }
            }
        }

        protected string GetGroup(object obj)
        {
            string s = string.Empty;
            switch (obj.ToString()) { 
                case "1" :
                    s = "Logo";
                    break;
                case "2" :
                    s = "Banners";
                    break;
                case "3" :
                    s = "Quảng cáo";
                    break;
                case "4" :
                    s= "Đối tác";
                    break;
            }

            return s;
                
        }

        protected string GetStatus(object obj)
        {
            if (obj.ToString().Equals("1"))
                return "Hiển thị";
            return "Ẩn";
        }
    }
}